//
//  FANStatus.m
//  Weibo - OC
//
//  Created by user on 16/4/21.
//  Copyright © 2016年 user. All rights reserved.
//

#import "FANStatus.h"
#import "FANUser.h"

@implementation FANStatus

+ (instancetype)modelWithDict:(NSDictionary *)dict{
    
    FANStatus *model = [[FANStatus alloc] init];
    
    [model setValuesForKeysWithDictionary:dict];
    
    return model;
}

-(void)setValue:(id)value forKey:(NSString *)key{
    
    if ([key isEqualToString:@"user"] && [value isKindOfClass:[NSDictionary class]]) {
        
        _user = [FANUser modelWithDict:value];
        
    }else if( [key isEqualToString:@"retweeted_status"]){
        
        _retweeted_status = [FANStatus modelWithDict:value];
        
    }else if( [key isEqualToString:@"pic_urls"]){
        
        NSMutableArray *tempArray = [NSMutableArray array];
        
        for (NSDictionary *dict in value) {
            
            FANStatusPicInfo *model = [FANStatusPicInfo modelWithDict:dict];
            
            [tempArray addObject:model];
        }
        
        _pic_urls = tempArray;
        
    }else{
        
        [super setValue:value forKey:key];
    }
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{}

@end
